<%= stylesheet_link_tag 'full_scroll_table' -%>
<% unless collection.empty? -%>
<div id="<%= resource_id -%>_hidden">
	</div>
<div  style="float:left;margin-left:60px;">
<div id="tableContainer" class="tableContainer">
<table id="<%= resource_id + "_source_table" -%>" border="0" cellpadding="0" cellspacing="0" width="100px" class="scrollTable">
<thead class="fixedHeader">

<!-- <div style="height:50px;"> -->
<!-- <table id="<%= resource_type + "_source_table" -%>"> -->
	<tr><th><%= resource_type -%></th></tr>
	</thead>
	<tbody class="scrollContent" id="<%= resource_id + "_source_table_body"-%>">
  	<% collection.each do |item| -%>
		  <% if authorization_for_showing_already_done || Authorization.is_authorized?("show", nil, item, current_user) -%>
		<tr id="<%= resource_id + "_" + item.id.to_s + "_source_row" -%>" <%= hide_style(true)  unless !selected.include?(item.id) -%>>
			<td id="<%= resource_id + "_" + item.id.to_s + "_source_cell"
			 -%>" onclick="javascript:checkItem('<%= item.id.to_s -%>', 'source', '<%= resource_id -%>')">
				<%= item.name -%>
			</td>
			</tr>
			<%= javascript_tag "addInstanceOfObject('#{resource_id}','#{item.id.to_s}', '#{escape_javascript(item.name)}')" -%>
			
		<% end -%>
		<% end -%>
		</tbody>
</table>
</div>
</div>
<div  style="float:right;margin-right:60px;">
<div id="tableContainer" class="tableContainer">
<table id="<%= resource_id + "_target_table" -%>" border="0" cellpadding="0" cellspacing="0" width="100px" class="scrollTable">
<thead class="fixedHeader">

	<tr><th>Share with these groups</th></tr>
	</thead>
	<tbody class="scrollContent" id="<%= resource_id + "_target_table_body"-%>">
  	<% collection.each do |item| -%>
		  <% if authorization_for_showing_already_done || Authorization.is_authorized?("show", nil, item, current_user) -%>
		<tr id="<%= resource_id + "_" + item.id.to_s + "_target_row" -%>" <%= hide_style(true) unless selected.include?(item.id) -%>>
			<td id="<%= resource_id + "_" + item.id.to_s + "_target_cell"
			 -%>" onclick="javascript:checkItem('<%= item.id.to_s -%>', 'target', '<%= resource_id -%>')">
				<%= item.name -%>
			</td>
			</tr>
			<% if selected.include?(item.id) -%>
				<%= javascript_tag "alreadySelected('#{resource_id}','#{item.id.to_s}', '#{escape_javascript(item.name)}')" -%>
			<% end -%>
		<% end -%>
		<% end -%>
		</tbody>
</table>
</div>
</div>

<div id="group_buttons">	
	<ul>
	<li>
		
		<%#= image_tag ( method_to_icon_filename("right_arrow_single"), :size => "50x50", :alt => "Add selected Data Extracts", :title=>"Add selected Data Extracts") -%>
<%= button_to_function('Add selected', "addSelected('#{resource_id}','source')") -%>
</li>
	<li>
		<%= button_to_function('Add all', "addAll('#{resource_id}','source')") -%>
		<%#= image_tag ( method_to_icon_filename("right_arrow_double"), :size => "50x50", :alt => "Add all Data Extracts", :title=>"Add all Data Extracts", :onclick=>"addAll('data_extracts','source')") -%>
</li>
	<li>
		<%#= image_tag ( method_to_icon_filename("left_arrow_single"), :size => "50x50", :alt => "Remove selected Data Extracts", :title=>"Remove selected Data Extracts") -%>
		<%= button_to_function('Remove selected', "addSelected('#{resource_id}','target')") -%>
		</li>
	<li>

		<%#= image_tag ( method_to_icon_filename("left_arrow_double"), :size => "50x50", :alt => "Remove all Data Extracts", :title=>"Remove all Data Extracts")-%>
<%= button_to_function('Remove all', "addAll('#{resource_id}','target')") -%>
	</li>
	</ul>
</div>
<% else %>
There are no groups to share with.  You can <%= link_to "create one", new_work_group_path -%> and try again.
<% end -%>

